export type ConnectionStatus = 'connecting' | 'connected' | 'disconnected' | 'reconnecting';

export interface TextMessagePayload {
  username: string;
  userId: string;
  dateTime: string;
  message: string;
}

export interface FileCheckPayload {
  type: 'file-check';
  userId: string;
  fileHash: string;
}

export interface FileStartPayload {
  type: 'file-start';
  username: string;
  userId: string;
  dateTime: string;
  fileName: string;
  fileSize: string;
  fileHash: string;
}

export interface FileChunkPayload {
  type: 'file-chunk';
  username: string;
  userId: string;
  fileName: string;
  fileSize: string;
  fileHash: string;
  chunkIndex: number;
  totalChunks: number;
  fileData: number[];
}

export interface FileCompletePayload {
  type: 'file-complete';
  username: string;
  userId: string;
  dateTime: string;
  fileName: string;
  fileSize: string;
  filePath: string;
  fileHash: string;
}

export interface FileExistsPayload {
  type: 'file-exists';
  fileHash: string;
  filePath: string;
}

export type WebSocketMessage = 
  | TextMessagePayload 
  | FileCheckPayload 
  | FileStartPayload 
  | FileChunkPayload 
  | FileCompletePayload 
  | FileExistsPayload;

export interface WebSocketState {
  connectionStatus: ConnectionStatus;
  lastMessage: MessageEvent | null;
}